package cn.vic.util;

import cn.vic.genertor.view.Root;
import org.apache.log4j.Logger;

import javax.swing.*;

/**
 * Created by vic on 2017/8/14.
 */
public class ImageUtil {
    private static final Logger LOGGER = Logger.getLogger(ImageUtil.class);

    /**
     * 创建图标
     *
     * @param path
     * @return
     */
    public static ImageIcon createImageIcon(String path) {
        java.net.URL imgURL = Root.class.getResource(path);
        if (imgURL != null) {
            return new ImageIcon(imgURL);
        } else {
            LOGGER.error("Couldn't find file: " + path);
            return null;
        }
    }

}
